home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Coats_Crochet.iso / App / Patterns.dxr / behaviors_45_Click Behavior (Sound).ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  2.6 KB  |  77 lines

  1. property DownSnd, UpSnd, Action, WhichLabel, standardImage, alternateImage
  2.  
  3. on mouseDown
  4.   click(DownSnd, UpSnd)
  5.   if Action = "Go to marker" then
  6.     go(WhichLabel)
  7.   else
  8.     if Action = "Play marker" then
  9.       play frame WhichLabel
  10.     end if
  11.   end if
  12. end
  13.  
  14. on beginSprite me
  15.   me.standardImage = the member of sprite me.spriteNum
  16.   memref = the member of sprite the currentSpriteNum
  17.   castLibNum = memref.castLibNum
  18.   alternateImage = member(memref.memberNum + 1, castLibNum)
  19. end
  20.  
  21. on mouseEnter me
  22.   set the member of sprite the spriteNum of me to me.alternateImage
  23. end
  24.  
  25. on mouseLeave me
  26.   if the mouseUp then
  27.     set the member of sprite the spriteNum of me to me.standardImage
  28.   end if
  29. end
  30.  
  31. on getPropertyDescriptionList
  32.   global ibcDefaultParams
  33.   if the currentSpriteNum = 0 then
  34.     memdefault = 0
  35.   else
  36.     memref = the member of sprite the currentSpriteNum
  37.     castLibNum = memref.castLibNum
  38.     memdefault = member(memref.memberNum + 1, castLibNum)
  39.   end if
  40.   if listp(ibcDefaultParams) then
  41.     return ibcDefaultParams
  42.   else
  43.     description = [:]
  44.     addProp(description, #Action, [#default: "None", #range: ["None", "Go to marker", "Play marker"], #format: #symbol, #comment: "MouseUp Action:"])
  45.     addProp(description, #WhichLabel, [#comment: "Destination Marker:", #format: #marker, #default: "next"])
  46.     return description
  47.   end if
  48. end
  49.  
  50. on getBehaviorDescription
  51.   return "- Click Behavior -" & RETURN & "Defined: controls a dual-image button." & RETURN & "Intended Use: to give user a simple audio + visual feedback that they've engaged a control. Rolling off button during mouseDown will disengage." & RETURN & RETURN & "- Properties -" & RETURN & "Down Sound: assigns a mouseDown button sound." & RETURN & "Up Sound: assigns a mouseUp button sound." & RETURN & "MouseUp Action: assigns a button course of action." & RETURN & "  (Note: Select 'None' if you plan to add a seperate mouseUp behavior to this button)" & RETURN & "Destination Marker: assigns a destination to the course of action." & RETURN & RETURN & "(Explore the 'LookHere' folder on the CD-Rom for examples of each behavior)"
  52. end
  53.  
  54. on click
  55.   emem = the memberNum of sprite clickOn()
  56.   puppetSound(2, "down")
  57.   updateStage()
  58.   set the memberNum of sprite clickOn() to emem + 1
  59.   updateStage()
  60.   repeat while the stillDown or soundBusy(2)
  61.     if rollover(clickOn()) then
  62.       set the memberNum of sprite clickOn() to emem + 1
  63.     else
  64.       set the memberNum of sprite clickOn() to emem - 1
  65.     end if
  66.     updateStage()
  67.   end repeat
  68.   puppetSound(2, "up")
  69.   updateStage()
  70.   set the memberNum of sprite clickOn() to emem
  71.   updateStage()
  72.   repeat while soundBusy(2)
  73.   end repeat
  74.   puppetSound(0)
  75.   updateStage()
  76. end
  77.